package cn.zkrt.iotms.comm;

import cn.zkrt.iotms.module.iot.validate.ValidationCategory;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class BaseEntity implements Serializable {

    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    @NotEmpty(message = "ID不能为空",groups = ValidationCategory.Update.class)
    private String id;

    /**
     * 创建用户
     */
    @TableField(value = "CREATE_USER", fill = FieldFill.INSERT)
    @ApiModelProperty("创建人")
    private String createUser;

    /**
     * 更新用户
     */
    @TableField(value = "UPDATE_USER", fill = FieldFill.UPDATE)
    @ApiModelProperty("更新人")
    private String updateUser;

    /**
     * 创建时间
     */
    @TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
    @ApiModelProperty("更新时间")
    private LocalDateTime updateTime;

    @TableField(value = "CREATE_DEPT", fill = FieldFill.INSERT)
    @ApiModelProperty("创建部门")
    private String createDept;

    /**
     * 是否删除
     */
    @TableField(value = "IS_DELETED")
    @ApiModelProperty("是否删除 0 否 1 是")
    private Integer isDeleted;
}
